<?php
$success = array("code"=>1,"message"=>"success","filename"=>$_FILES["file"]["name"]);
$fail = array("code"=>2,"message"=>"fail","filename"=>$_FILES["file"]["name"]);
$res_success = json_encode($success);
$res_fail = json_encode($fail);
header("Content-Type:application/json");
echo $_POST["name"];
if ($_FILES["file"]["error"] > 0)
{
echo $res_fail;
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
echo $res_success;
}


?>

//curl 命令：curl localhost/note/upload.php -F "file=@D:\Documents\temp.txt" -F "name=liujiang"   name参数可选，可以当作密码